fix lowranceusr4 writer issues (#376)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Thu, 29 Aug 2019 15:38:04 +0000 (09:38 -0600)
committerGitHub <noreply@github.com>
Thu, 29 Aug 2019 15:38:04 +0000 (09:38 -0600)
commit8fd790e1beceaee4062b4694f0b699c12c5cfafe
tree620c04f533194a1742ac20cc82e0d0f5008c42d2
parent086f74064dbbc3e4226fb21107c99281a43097ed
fix lowranceusr4 writer issues (#376)

* fixes for lowraneusr writer for versions >= 4.

use fs_chain_find when looking for FS_LOWRANCEUSR4 data.
and check for nullptr to verify FS_LOWRANCEUSR4 data exists.

* using rounding in lowranceusr lat/lon conversions.

This gives as a chance of usr->gpx->usr matching.

Update gpsbabel generated usr reference files for these
rounding differences.

* fix lowranceusr4 writer issues.

when writing embedded UTF-16LE strings in lowranceusr version >=4
don't inlucde BOM.

don't offset returned values from lowranceusr4_jd_from_timestamp
by 12 hours, thus matching the inverse transformation in
lowranceusr4_get_timestamp.

when writing lowranceusr version >=4 trails output the given number
of mysterious attribute bytes, i.e. 0.

This almost enables a gpx -> usr -> gpx test loop, which is included
but commented in lowranceusr.test.

* fixes to enable lowranceusr v4 round trip testing.

use templates for lowranceusr*_find_desc_from_icon_number
and lowranceusr*_find_icon_number_from_desc.

enhance lowranceusr*_find_icon_number_from_desc to
recongnize icon-n where n is an integer as icon number n.
This is necessary for the v4 round trip test.

declare lowranceusr*_find_desc_from_icon_number to be static
to limit visibilty. Drop const return type.

declare lowranceusr4_find_color_from_icon_number_plus_color_index
to be static to limit visiblity.

* fix new lowranceusr memory leak.
lowranceusr.cc
reference/lowrance-enchilada.usr
reference/lowrance-ignoreicons.usr
reference/lowrance.usr
testo.d/lowranceusr.test